<!-- 法人信息 -->
<template>
  <div class='legalPerson'>
    <el-card class="box-card">
      <div slot="header" class="clearfix">
        <span>企业基本信息</span>
        <el-button v-show="true" type="text" size="medium" style="padding: 0px 15px" @click="basicinfoByname()">刷新数据
        </el-button>
        <span v-show="true" style="float: right; padding: 3px 0" type="text">获取数据时间：{{refreshTime[0] || '暂无'}}</span>
      </div>
      <div>
        <tableComponent :tableStyle="{ width:'100%' }">
          <tr slot="tr_l">
            <td>主体身份代码</td>
            <td>{{EX_ZZ_GSJ_E_BASEINFO.pripid || '-' }}</td>
          </tr>
          <tr slot="tr_l">
            <td>企业(机构) 名称</td>
            <td>{{EX_ZZ_GSJ_E_BASEINFO.entname || '-'}}</td>
          </tr>
          <tr slot="tr_l">
            <td>市场主体类型</td>
            <td>{{EX_ZZ_GSJ_E_BASEINFO.entype || '-'}}</td>
          </tr>
          <tr slot="tr_l">
            <td>行业门类</td>
            <td>{{EX_ZZ_GSJ_E_BASEINFO.industryphy || '-'}}</td>
          </tr>
          <tr slot="tr_l">
            <td>成立日期</td>
            <td>{{EX_ZZ_GSJ_E_BASEINFO.estdate || '-'}}</td>
          </tr>
          <tr slot="tr_l">
            <td>登记机关(中文名称)</td>
            <td>{{EX_ZZ_GSJ_E_BASEINFO.regorg_CN || '-'}}</td>
          </tr>
          <tr slot="tr_l">
            <td>业务范围类型(中文名称)</td>
            <td>{{EX_ZZ_GSJ_E_BASEINFO.opscotype_CN || '-'}}</td>
          </tr>
          <tr slot="tr_l">
            <td>经营(驻在)期限自</td>
            <td>{{EX_ZZ_GSJ_E_BASEINFO.opfrom || '-'}}</td>
          </tr>
          <tr slot="tr_l">
            <td>登记状态</td>
            <td>{{EX_ZZ_GSJ_E_BASEINFO.regstate || '-'}}</td>
          </tr>
          <tr slot="tr_l">
            <td>住所所在行政区划</td>
            <td>{{EX_ZZ_GSJ_E_BASEINFO.domdistrict || '-'}}</td>
          </tr>
          <tr slot="tr_l">
            <td>注册资本(金)</td>
            <td>{{EX_ZZ_GSJ_E_BASEINFO.regcap || '-'}}</td>
          </tr>
          <tr slot="tr_l">
            <td>注册资本(金)币种(中文名称)</td>
            <td>{{EX_ZZ_GSJ_E_BASEINFO.regcapcur_CN || '-'}}</td>
          </tr>
          <tr slot="tr_l">
            <td>实收资本</td>
            <td>{{EX_ZZ_GSJ_E_BASEINFO.reccap || '-'}}</td>
          </tr>
          <tr slot="tr_l">
            <td>国别(地区)</td>
            <td>{{EX_ZZ_GSJ_E_BASEINFO.country || '-'}}</td>
          </tr>
          <tr slot="tr_l">
            <td>是否城镇</td>
            <td>{{EX_ZZ_GSJ_E_BASEINFO.town || '-'}}</td>
          </tr>
          <tr slot="tr_l">
            <td>统计企业类型</td>
            <td>{{EX_ZZ_GSJ_E_BASEINFO.reporttype || '-'}}</td>
          </tr>
          <tr slot="tr_l">
            <td>数据更新时间</td>
            <td>{{EX_ZZ_GSJ_E_BASEINFO.s_EXT_DATATIME || '-'}}</td>
          </tr>
          <tr slot="tr_r">
            <td>统一社会信用代码</td>
            <td>{{EX_ZZ_GSJ_E_BASEINFO.uniscid || '-'}}</td>
          </tr>
          <tr slot="tr_r">
            <td>注册号</td>
            <td>{{EX_ZZ_GSJ_E_BASEINFO.regno || '-'}}</td>
          </tr>
          <tr slot="tr_r">
            <td>市场主体类型(中文名称)</td>
            <td>{{EX_ZZ_GSJ_E_BASEINFO.entype_CN || '-'}}</td>
          </tr>
          <tr slot="tr_r">
            <td>行业代码</td>
            <td>{{EX_ZZ_GSJ_E_BASEINFO.industryco || '-'}}</td>
          </tr>
          <tr slot="tr_r">
            <td>登记机关</td>
            <td>{{EX_ZZ_GSJ_E_BASEINFO.regorg || '-'}}</td>
          </tr>
          <tr slot="tr_r">
            <td>业务范围类型</td>
            <td>{{EX_ZZ_GSJ_E_BASEINFO.opscotype || '-'}}</td>
          </tr>
          <tr slot="tr_r">
            <td>经营范围</td>
            <td>{{EX_ZZ_GSJ_E_BASEINFO.opscope || '-'}}</td>
          </tr>
          <tr slot="tr_r">
            <td>经营(驻在)期限至</td>
            <td>{{EX_ZZ_GSJ_E_BASEINFO.opto || '-'}}</td>
          </tr>
          <tr slot="tr_r">
            <td>登记状态(中文名称)</td>
            <td>{{EX_ZZ_GSJ_E_BASEINFO.regstate_CN || '-'}}</td>
          </tr>
          <tr slot="tr_r">
            <td>住所</td>
            <td>{{EX_ZZ_GSJ_E_BASEINFO.dom || '-'}}</td>
          </tr>
          <tr slot="tr_r">
            <td>注册资本(金)币种</td>
            <td>{{EX_ZZ_GSJ_E_BASEINFO.regcapcur || '-'}}</td>
          </tr>
          <tr slot="tr_r">
            <td>注册资本(金)折万美元</td>
            <td>{{EX_ZZ_GSJ_E_BASEINFO.regcapusd || '-'}}</td>
          </tr>
          <tr slot="tr_r">
            <td>实收资本折万美元</td>
            <td>{{EX_ZZ_GSJ_E_BASEINFO.reccapusd || '-'}}</td>
          </tr>
          <tr slot="tr_r">
            <td>从业人员/农专成员总数</td>
            <td>{{EX_ZZ_GSJ_E_BASEINFO.empnum || '-'}}</td>
          </tr>
          <tr slot="tr_r">
            <td>法定代表人</td>
            <td>{{EX_ZZ_GSJ_E_BASEINFO.name || '-'}}</td>
          </tr>
          <tr slot="tr_r">
            <td>核准日期</td>
            <td>{{EX_ZZ_GSJ_E_BASEINFO.apprdate || '-'}}</td>
          </tr>
        </tableComponent>
      </div>
    </el-card>

    <el-card class="box-card">
      <div slot="header" class="clearfix">
        <span>税务登记设立信息</span>
        <el-button v-show="true" type="text" size="medium" style="padding: 0px 15px" @click="certificationInfo()">刷新数据
        </el-button>
        <span v-show="true" style="float: right; padding: 3px 0" type="text">获取数据时间：{{refreshTime[1] || '暂无'}}</span>
      </div>
      <div>
        <tableComponent :tableStyle="{ width:'100%' }">
          <!-- 左 -->
          <tr slot="tr_l">
            <td>纳税人识别号</td>
            <td>{{EX_DSJ_WBJH_CJ_FGW_SWDJXX.nsrsbh || '-'}}</td>
          </tr>
          <tr slot="tr_l">
            <td>纳税人状态</td>
            <td>{{EX_DSJ_WBJH_CJ_FGW_SWDJXX.nsrztmc || '-'}}</td>
          </tr>
          <tr slot="tr_l">
            <td>登记注册类型</td>
            <td>{{EX_DSJ_WBJH_CJ_FGW_SWDJXX.djzclcmc || '-'}}</td>
          </tr>
          <tr slot="tr_l">
            <td>批准设立机关</td>
            <td>{{EX_DSJ_WBJH_CJ_FGW_SWDJXX.pzsljgmc || '-'}}</td>
          </tr>
          <tr slot="tr_l">
            <td>证照编号</td>
            <td>{{EX_DSJ_WBJH_CJ_FGW_SWDJXX.zzlxmc || '-'}}</td>
          </tr>
          <tr slot="tr_l">
            <td>经营范围</td>
            <td>{{EX_DSJ_WBJH_CJ_FGW_SWDJXX.jyfw || '-'}}</td>
          </tr>
          <tr slot="tr_l">
            <td>主管税务机关</td>
            <td>{{EX_DSJ_WBJH_CJ_FGW_SWDJXX.swjgmc || '-'}}</td>
          </tr>
          <tr slot="tr_l">
            <td>法定代表人姓名</td>
            <td>{{EX_DSJ_WBJH_CJ_FGW_SWDJXX.fddbrxm || '-'}}</td>
          </tr>
          <tr slot="tr_l">
            <td>法定代表人身份证号码</td>
            <td>{{EX_DSJ_WBJH_CJ_FGW_SWDJXX.fddbrsfzjhm || '-'}}</td>
          </tr>
          <tr slot="tr_l">
            <td>法定代表人移动电话</td>
            <td>{{EX_DSJ_WBJH_CJ_FGW_SWDJXX.fddbryddh || '-'}}</td>
          </tr>
          <tr slot="tr_l">
            <td>核算方式</td>
            <td>{{EX_DSJ_WBJH_CJ_FGW_SWDJXX.hsfsmc || '-'}}</td>
          </tr>
          <!-- 右 -->
          <tr slot="tr_r">
            <td>纳税人名称</td>
            <td>{{EX_DSJ_WBJH_CJ_FGW_SWDJXX.nsrmc || '-'}}</td>
          </tr>
          <tr slot="tr_r">
            <td>课征主体登记类型</td>
            <td>{{EX_DSJ_WBJH_CJ_FGW_SWDJXX.kzztdjlxmc || '-'}}</td>
          </tr>
          <tr slot="tr_r">
            <td>组织机构代码</td>
            <td>{{EX_DSJ_WBJH_CJ_FGW_SWDJXX.zzjg_dm || '-'}}</td>
          </tr>
          <tr slot="tr_r">
            <td>证照名称</td>
            <td>{{EX_DSJ_WBJH_CJ_FGW_SWDJXX.zzhm || '-'}}</td>
          </tr>
          <tr slot="tr_r">
            <td>开业设立日期</td>
            <td>{{EX_DSJ_WBJH_CJ_FGW_SWDJXX.kyslrq || '-'}}</td>
          </tr>
          <tr slot="tr_r">
            <td>登记日期</td>
            <td>{{EX_DSJ_WBJH_CJ_FGW_SWDJXX.djrq || '-'}}</td>
          </tr>
          <tr slot="tr_r">
            <td>注册地址</td>
            <td>{{EX_DSJ_WBJH_CJ_FGW_SWDJXX.zcdz || '-'}}</td>
          </tr>
          <tr slot="tr_r">
            <td>法定代表人身份证件类型</td>
            <td>{{EX_DSJ_WBJH_CJ_FGW_SWDJXX.sfzjlxmc || '-'}}</td>
          </tr>
          <tr slot="tr_r">
            <td>法定代表人固定电话</td>
            <td>{{EX_DSJ_WBJH_CJ_FGW_SWDJXX.fddbrgddh || '-'}}</td>
          </tr>
          <tr slot="tr_r">
            <td>行业</td>
            <td>{{EX_DSJ_WBJH_CJ_FGW_SWDJXX.hymc || '-'}}</td>
          </tr>
          <tr slot="tr_r">
            <td>总分机构类型</td>
            <td>{{EX_DSJ_WBJH_CJ_FGW_SWDJXX.zfjglxmc || '-'}}</td>
          </tr>
        </tableComponent>
      </div>
    </el-card>
    <!-- 个体经营异常标记信息 -->
    <el-card class="box-card">
      <div slot="header" class="clearfix">
        <span>企业异常名录信息</span>
        <el-button v-show="true" type="text" size="medium" style="padding: 0px 15px" @click="selectQyycmlxx()">刷新数据
        </el-button>
        <span v-show="true" style="float: right; padding: 3px 0" type="text">获取数据时间：{{refreshTime[2] || '暂无'}}</span>
      </div>
      <div>
        <el-table :data="EX_ZZ_GSJ_AO_OPANOMALY" border style="width: 100%">
          <el-table-column prop="specause_CN" align="center" label="列入经营异常名录原因类型">
          </el-table-column>
          <el-table-column prop="abntime" align="center" label="列入日期">
          </el-table-column>
          <el-table-column prop="decorg_CN" align="center" label="列入决定机关">
          </el-table-column>
          <el-table-column prop="s_EXT_DATATIME" align="center" label="数据更新时间">
          </el-table-column>
        </el-table>
      </div>
    </el-card>
    <!-- 严重违法失信企业名单 -->
    <el-card class="box-card">
      <div slot="header" class="clearfix">
        <span>严重违法失信企业名单</span>
        <el-button v-show="true" type="text" size="medium" style="padding: 0px 15px" @click="selectYzwfsxqymd()">刷新数据
        </el-button>
        <span v-show="true" style="float: right; padding: 3px 0" type="text">获取数据时间：{{refreshTime[3] || '暂无'}}</span>
      </div>
      <div>
        <el-table :data="EX_ZZ_GSJ_E_LI_ILLDISHONESTY" border style="width: 100%">
          <el-table-column prop="serillrea" align="center" label="列入事由/情形">
          </el-table-column>
          <el-table-column prop="abntime" align="center" label="列入日期">
          </el-table-column>
          <el-table-column prop="decorg_CN" align="center" label="列入作出决定机关">
          </el-table-column>
          <el-table-column prop="dedocnum" align="center" label="列入文号">
          </el-table-column>
          <el-table-column prop="s_EXT_DATATIME" align="center" label="数据更新时间">
          </el-table-column>
        </el-table>
      </div>
    </el-card>
  </div>
</template>

<script>
import tableComponent from './components/tableComponents'
import { legalPerson, basicinfoByname, certificationInfo, selectQyycmlxx, selectYzwfsxqymd } from '../../../../api/legalPerson'
export default {
  components: {
    tableComponent
  },
  data () {
    return {
      legalPersonObj: {},
      // 企业基本信息
      EX_ZZ_GSJ_E_BASEINFO: {},
      // 税务登记设立信息
      EX_DSJ_WBJH_CJ_FGW_SWDJXX: {},
      // 个体经营异常标记信息
      EX_ZZ_GSJ_AO_OPANOMALY: [],
      // 严重违法失信企业名单
      EX_ZZ_GSJ_E_LI_ILLDISHONESTY: [],
      tableData: [],
      refreshTime: ['', '', '', ''],

    };
  },
  computed: {},
  watch: {
    '$route.query.name': function (val, oldVal) {
      this.$nextTick(() => {
        this.legalPerson();
      })
    }
  },
  methods: {
    // legalPerson () {
    //   if (!this.$route.query.name) return false
    //   let obj = {
    //     name: this.$route.query.name
    //   }
    // 1.企业基本信息:
    basicinfoByname () {
      const loading = this.$loading({
        lock: true,
        text: 'Loading',
        spinner: 'el-icon-loading',
        background: 'rgba(0, 0, 0, 0.2)'
      });
      if (!this.$route.query.name) return false
      let obj = {
        name: this.$route.query.name
      }
      basicinfoByname(obj).then(res => {
        if (res.data.EX_ZZ_GSJ_E_BASEINFO.data) {
          this.EX_ZZ_GSJ_E_BASEINFO = res.data.EX_ZZ_GSJ_E_BASEINFO.data[0] || {}
          this.refreshTime[0] = res.data.refreshTime.refreshTime
          loading.close()
        } else {
          loading.close()
        }
      }).catch(e => {
        loading.close()
      })
    },

    // 2.税务登记设立信息
    certificationInfo () {
      const loading = this.$loading({
        lock: true,
        text: 'Loading',
        spinner: 'el-icon-loading',
        background: 'rgba(0, 0, 0, 0.2)'
      });
      if (!this.$route.query.name) return false
      let obj = {
        name: this.$route.query.name
      }
      certificationInfo(obj).then(res => {
        if (res.data.EX_DSJ_WBJH_CJ_FGW_SWDJXX.data) {
          this.EX_DSJ_WBJH_CJ_FGW_SWDJXX = res.data.EX_DSJ_WBJH_CJ_FGW_SWDJXX.data[0] || {}
          this.refreshTime[1] = res.data.refreshTime.refreshTime
          loading.close()
        } else {
          loading.close()
        }
      }).catch(e => {
        loading.close()
      })
    },

    //3.企业异常名录信息
    selectQyycmlxx () {
      const loading = this.$loading({
        lock: true,
        text: 'Loading',
        spinner: 'el-icon-loading',
        background: 'rgba(0, 0, 0, 0.2)'
      });
      if (!this.$route.query.name) return false
      let obj = {
        name: this.$route.query.name
      }
      selectQyycmlxx(obj).then(res => {
        if (res.data.EX_ZZ_GSJ_AO_OPANOMALY.data) {
          this.EX_ZZ_GSJ_AO_OPANOMALY = res.data.EX_ZZ_GSJ_AO_OPANOMALY.data || []
          this.refreshTime[2] = res.data.refreshTime.refreshTime
          loading.close()
        } else {
          loading.close()
        }
      }).catch(e => {
        loading.close()
      })
    },

    //4.严重违法失信企业名单
    selectYzwfsxqymd () {
      const loading = this.$loading({
        lock: true,
        text: 'Loading',
        spinner: 'el-icon-loading',
        background: 'rgba(0, 0, 0, 0.2)'
      });
      if (!this.$route.query.name) return false
      let obj = {
        name: this.$route.query.name
      }
      selectYzwfsxqymd(obj).then(res => {
        if (res.data.EX_ZZ_GSJ_E_LI_ILLDISHONESTY.data) {
          this.EX_ZZ_GSJ_E_LI_ILLDISHONESTY = res.data.EX_ZZ_GSJ_E_LI_ILLDISHONESTY.data || []
          this.refreshTime[3] = res.data.refreshTime.refreshTime
          loading.close()
        } else {
          loading.close()
        }
      }).catch(e => {
        loading.close()
      })
    }



    // legalPerson(obj).then(res => {
    //   if (res.success) {
    //     this.legalPersonObj = res.data
    //     // 企业基本信息
    //     if (res.data.EX_ZZ_GSJ_E_BASEINFO.data) {
    //       this.EX_ZZ_GSJ_E_BASEINFO = res.data.EX_ZZ_GSJ_E_BASEINFO.data[0] || {}
    //     }

    //     // 税务登记设立信息
    //     if (res.data.EX_DSJ_WBJH_CJ_FGW_SWDJXX.data) {
    //       this.EX_DSJ_WBJH_CJ_FGW_SWDJXX = res.data.EX_DSJ_WBJH_CJ_FGW_SWDJXX.data[0] || {}
    //     }

    //     // 经营异常
    //     if (res.data.EX_ZZ_GSJ_AO_OPANOMALY.data) {
    //       this.EX_ZZ_GSJ_AO_OPANOMALY = res.data.EX_ZZ_GSJ_AO_OPANOMALY.data || []
    //     }

    //     // 严重违法失信
    //     if (res.data.EX_ZZ_GSJ_E_LI_ILLDISHONESTY.data) {
    //       this.EX_ZZ_GSJ_E_LI_ILLDISHONESTY = res.data.EX_ZZ_GSJ_E_LI_ILLDISHONESTY.data || []
    //     }

    //     console.log(res.data, '789789789789789789789')
    //   }
    // })
    // }
  },
  created () {
    this.basicinfoByname()
    this.certificationInfo()
    this.selectQyycmlxx()
    this.selectYzwfsxqymd()
  },
  mounted () {

  },
  beforeCreate () { },
  beforeMount () { },
  beforeUpdate () { },
  updated () { },
  beforeDestroy () { },
  destroyed () { },
  activated () { },
}
</script>
<style scoped>
tr {
    width: 50%;
}
td {
    width: 25%;
}
</style>